package com.util;

public class StrUtil {
    /**
     * 生成指定数量的字符串
     * @param numberOfSpaces 字符串数量
     * @return 返回字符串字符串
     */
    public static String generateSpaces(int numberOfSpaces) {
        if (numberOfSpaces < 0) {
            throw new IllegalArgumentException("numberOfSpaces cannot be negative.");
        }
        StringBuilder spaces = new StringBuilder(numberOfSpaces);
        for (int i = 0; i < numberOfSpaces; i++) {
            spaces.append(' ');
        }
        return spaces.toString();
    }
}
